package com.besall.allbase.bluetooth.service.Protocol;

import static com.bes.bessdk.BesSdkConstants.BES_CONNECT_ERROR;
import static com.bes.bessdk.BesSdkConstants.BES_CONNECT_SUCCESS;
import static com.bes.sdk.message.Constants.TOTAL_WORKOUT_TRK_FILE_MISSED_END;
import static com.bes.sdk.message.Constants.TOTAL_WORKOUT_TRK_FILE_MISSED_NOT_END;
import static com.besall.allbase.bluetooth.service.Protocol.ProtocolConstants.*;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import androidx.annotation.NonNull;
import bb.lanxing.R;
import bb.lanxing.device.sgdevcie.storage.fragment.BBWorkoutsManagerFragment;
import bb.lanxing.model.database.Device;
import bb.lanxing.util.CommonUtil;
import com.bes.bessdk.BesSdkConstants;
import com.bes.bessdk.scan.BtHeleper;
import com.bes.bessdk.service.base.BesBaseService;
import com.bes.bessdk.service.base.BesServiceConfig;
import com.bes.bessdk.service.base.BesServiceListener;
import com.bes.bessdk.utils.ArrayUtil;
import com.bes.bessdk.utils.SPHelper;
import com.bes.sdk.device.HmDevice;
import com.bes.sdk.message.BaseMessage;
import com.bes.sdk.message.CmdPackageHeader;
import com.bes.sdk.message.Constants;
import com.bes.sdk.message.MsgStrAnalyzer;
import com.bes.sdk.utils.DeviceProtocol;
import com.bes.sdk.utils.SettingsJsonUtils;
import com.besall.allbase.common.utils.FileUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ProtocolService extends BesBaseService {
	public static final long mWatchDialSendPacket = 10;
	private static final List<String> mListFiles = new ArrayList<>();
	private static final List<String> mListRouteBooksFiles = new ArrayList<>();
	private final Context mContext;
	private final ProtocolCMD protocolCMD;
	private final MsgStrAnalyzer msgStrAnalyzer;
	private String device_model;
	private String sn;
	private List<byte[]> packet = new ArrayList<>();
	private int p = 0;
	private long milliS = 0;

	public ProtocolService(BesServiceConfig serviceConfig, BesServiceListener listener, Context context) {
		super(serviceConfig, listener, context);
		startConnect(serviceConfig);
		protocolCMD = new ProtocolCMD();
		msgStrAnalyzer = new MsgStrAnalyzer();
		mContext = context;
	}

	public String getDevice_model() {
		return device_model;
	}

	public void setDevice_model(String device_model) {
		this.device_model = device_model;
	}

	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}

	@Override public void onStatusChanged(HmDevice device, int status, DeviceProtocol protocol) {
		super.onStatusChanged(device, status, protocol);
		Log.d(TAG, "protocol service status changed,status: " + status);
		if (status == BES_CONNECT_SUCCESS) {
			callBackStateChangedMessage(BES_CONNECT_SUCCESS, "");
		} else if (getDeviceConnectState(mConfig) != BesSdkConstants.BesConnectState.BES_CONNECT) {
			callBackErrorMessage(status);
		} else if (status == BES_CONNECT_ERROR) {
			String msgStr = mContext.getString(R.string.ble_device_disconnected);// add by wangsm
			callBackStateChangedMessage(BES_CONNECT_ERROR, msgStr);
		}
	}

	public void changeDevice(BesServiceConfig serviceConfig) {
		startConnect(serviceConfig);
	}

	public void onDataReceived(BaseMessage deviceMessage) {
		super.onDataReceived(deviceMessage);
		Log.i(TAG, "onDataReceived(Hex): -----" + ArrayUtil.toHex((byte[]) deviceMessage.getMsgContent()));
		device_model = SettingsJsonUtils.getDeviceModel(mContext);
		sn = SettingsJsonUtils.getSn(mContext);
		String fileName = (String) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, "");

		byte[] msgContentBody = (byte[]) deviceMessage.getMsgContent();
		int pkgIndex = MsgStrAnalyzer.byteToBigInteger(msgContentBody, Constants.MULTI_PACKAGE_INDEX_START, Constants.MULTI_PACKAGE_PACK_NUM_START);
		if (pkgIndex == 0 && msgContentBody[0] == Constants.GENERAL_PROTOCOL_MULTI_PKG_SIGN) {
			if (msgContentBody.length > Constants.MULTI_FIRST_PACKAGE_HEADER_LEN) {
				byte[] packageHeader = new byte[Constants.MULTI_FIRST_PACKAGE_HEADER_LEN];
				System.arraycopy(msgContentBody, 0, packageHeader, 0, Constants.MULTI_FIRST_PACKAGE_HEADER_LEN);
				MsgStrAnalyzer.dph = MsgStrAnalyzer.parseMultiPackageHeader(packageHeader);
			} else {
				if (msgContentBody.length > 5) {
					MsgStrAnalyzer.dph = MsgStrAnalyzer.parseMultiPackageHeader(msgContentBody);
				}
			}
		}

		byte[] msgContentHeader = new byte[Constants.CMD_HEADER_LEN];
		System.arraycopy(deviceMessage.getMsgContent(), 0, msgContentHeader, 0, Constants.CMD_HEADER_LEN);
		if (msgContentBody.length >= 5) {
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB2, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB2, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] failByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, failByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (failByteRsp[0] == -1 && msgContentBody.length == 5) { // xxx.trk Fail 0xFF
					int index = (int) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
					Log.d(TAG, "not .trk&.wk file is true,fileName==" + fileName + "index==" + pkgIndex + "CURRENT_INDEX==" + index);
					index++;
					if (index < mListFiles.size()) {
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, index);
						String nextfileName = mListFiles.get(index);
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, nextfileName);
						bikewatch_get_track_detail(nextfileName);
						callBackErrorMessage(TOTAL_WORKOUT_TRK_FILE_MISSED_NOT_END, fileName);
					} else {
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, "");
						callBackErrorMessage(TOTAL_WORKOUT_TRK_FILE_MISSED_END, fileName);
						mListFiles.clear();
					}
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB0, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB0, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] failByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, failByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (failByteRsp[0] == -2 && msgContentBody.length == 5) { // workout.list Fail 0xFE
					callBackErrorMessage(Constants.NO_JSON_FILE_EXIST);
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DC5, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DC5, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] failByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, failByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (failByteRsp[0] == -2 && msgContentBody.length == 5) { // routebooks.json Fail 0xFE
					callBackErrorMessage(Constants.NO_JSON_FILE_EXIST);
					String filePathStr = FileUtils.checkExternalDirectoryPathExist(true, device_model, sn, SettingsJsonUtils.ROUTE_BOOKS_FOLDER, SettingsJsonUtils.ROUTE_BOOKS_JSON);
					if (filePathStr != null) {
						FileUtils.deleteFile(filePathStr);
					}
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB7, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB7, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] failByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, failByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (failByteRsp[0] == -2 && msgContentBody.length == 5) { // user_profile.json Fail 0xFE
					callBackErrorMessage(Constants.NO_JSON_FILE_EXIST);
					String filePathStr = FileUtils.checkExternalDirectoryPathExist(true, device_model, sn, SettingsJsonUtils.SETTINGS, SettingsJsonUtils.USERPROFILE_JSON);
					if (filePathStr != null) {
						FileUtils.deleteFile(filePathStr);
					}
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DEB, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DEB, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] receiveByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, receiveByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (msgContentBody.length == 5) { // unbind pair status 0x08
					String address = mConfig.getDevice().getBleAddress();
					boolean result = BtHeleper.unBondedBleDevice(mContext, address);
					if (result) {
						Device.deleteByAddress(address);
					}
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DC9, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DC9, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] receiveByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, receiveByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (msgContentBody.length == 7) { // get settings.json req
					try {
						Thread.sleep(500);
					} catch (InterruptedException e) {
						throw new RuntimeException(e);
					}
					bikewatch_get_settings_info(SettingsJsonUtils.SETTING_JSON);
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD7, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD7, MsgStrAnalyzer.dph.getCmdId()))) {
				int rspLength = msgContentBody.length - Constants.CMD_HEADER_LEN - 8;
				byte[] receiveTotalByteRsp = new byte[rspLength];
				System.arraycopy(msgContentBody, 4, receiveTotalByteRsp, 0, rspLength);
				byte[] receiveFreeByteRsp = new byte[rspLength];
				System.arraycopy(msgContentBody, 12, receiveFreeByteRsp, 0, rspLength);
				if (receiveTotalByteRsp.length == 8) {
					int freeSpace = ArrayUtil.bytesToIntLittle(receiveFreeByteRsp);
					int totalSpace = ArrayUtil.bytesToIntLittle(receiveTotalByteRsp);
					Log.i(TAG, "Total emmc1(Hex): -----" + totalSpace);
					Log.i(TAG, "Free emmc1(Hex): -----" + freeSpace);
					Log.d(TAG, "emmc1 total space = " + totalSpace + " free space = " + freeSpace);
					String usedSpace = totalSpace - freeSpace + "," + totalSpace;
					callBackStateChangedMessage(GET_DEVICE_MEMORY_USED, usedSpace);
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD8, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD8, MsgStrAnalyzer.dph.getCmdId()))) {
				int rspLength = msgContentBody.length - Constants.CMD_HEADER_LEN;
				byte[] receiveLeftTimeRsp = new byte[rspLength];
				System.arraycopy(msgContentBody, 4, receiveLeftTimeRsp, 0, rspLength);
				if (receiveLeftTimeRsp.length >= 1) {
					int icoeLeftTime = ArrayUtil.bytesToIntLittle(receiveLeftTimeRsp);
					Log.d(TAG, "icoe data left time = " + icoeLeftTime);
					callBackStateChangedMessage(GET_DEVICE_SATELLITE_DATA, String.valueOf(icoeLeftTime));
					INFO_Get_mac_address();
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD9, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD9, MsgStrAnalyzer.dph.getCmdId()))) {
				int rspLength = msgContentBody.length - Constants.CMD_HEADER_LEN;
				byte[] receiveSetPkgMtuRsp = new byte[rspLength];
				System.arraycopy(msgContentBody, 4, receiveSetPkgMtuRsp, 0, rspLength);
				if (receiveSetPkgMtuRsp.length >= 1) {
					Log.d(TAG, "Set pkg mtu success!!!");
					callBackSuccessMessage(SET_DEVICE_PKU_SUCCESS);
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDB, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDB, MsgStrAnalyzer.dph.getCmdId()))) {
				byte[] failByteRsp = new byte[msgContentBody.length - Constants.CMD_HEADER_LEN];
				System.arraycopy(msgContentBody, 4, failByteRsp, 0, msgContentBody.length - Constants.CMD_HEADER_LEN);
				if (failByteRsp[0] == -1 && msgContentBody.length == 5) { // xxx.log Fail 0xFF
					int index = (int) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
					Log.d(TAG, "not .log file is true,fileName==" + fileName + "index==" + pkgIndex + "CURRENT_INDEX==" + index);
					index++;
					if (index < mListFiles.size()) {
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, index);
						String nextfileName = mListFiles.get(index);
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, nextfileName);
						bikewatch_get_bb_offline_log(nextfileName);
						//callBackErrorMessage(TOTAL_WORKOUT_TRK_FILE_MISSED_NOT_END, fileName);
					} else {
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
						SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, "");
						//callBackErrorMessage(TOTAL_WORKOUT_TRK_FILE_MISSED_END, fileName);
						mListFiles.clear();
					}
					return;
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDC, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDC, MsgStrAnalyzer.dph.getCmdId()))) {
				int rspLength = msgContentBody.length - Constants.CMD_HEADER_LEN;
				byte[] receiveLogLevelByteRsp = new byte[rspLength];
				System.arraycopy(msgContentBody, 4, receiveLogLevelByteRsp, 0, rspLength);
				if (receiveLogLevelByteRsp.length >= 4) {
					int logLevel = ArrayUtil.bytesToIntLittle(receiveLogLevelByteRsp);
					callBackSuccessMessage(Constants.DEVICE_LOG_GET_LEVEL_SUCCESS, String.valueOf(logLevel));
					Log.i(TAG, "BB Offline Log level(Hex): -----" + logLevel);
					return;
				}
			}
		}
		boolean bResult = MsgStrAnalyzer.startSaveFile((byte[]) deviceMessage.getMsgContent(), mContext, device_model, sn, fileName);
		Log.i(TAG, "onDataReceived bResult = " + bResult);
		if (bResult) {
			if (MsgStrAnalyzer.isExistFilePath()) {
				callBackSuccessMessage(MsgStrAnalyzer.getMsgCallBackId(), MsgStrAnalyzer.getFilePath());
			} else {
				callBackSuccessMessage(MsgStrAnalyzer.getMsgCallBackId());
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB2, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB2, MsgStrAnalyzer.dph.getCmdId()))) {
				int index = (int) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
				Log.d(TAG, "save .trk&.wk file is true,fileName==" + fileName + "index==" + pkgIndex + "CURRENT_INDEX==" + index);
				index++;
				if (index < mListFiles.size()) {
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, index);
					String nextfileName = mListFiles.get(index);
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, nextfileName);
					bikewatch_get_track_detail(nextfileName);
				} else {
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, "");
					Log.i(TAG, "onDataReceived-----,all file download finished===,send TOTAL_TRK_FILE_TRANS_SUCCESS");
					if (index == mListFiles.size()) {
						MsgStrAnalyzer.currentAllFileLength = 0;
						MsgStrAnalyzer.saveCurrentTrkPackageIndex(mContext, 0);
						BBWorkoutsManagerFragment.saveTrkTotalPackageNum(mContext, 0);
						callBackSuccessMessage(Constants.TOTAL_TRK_FILE_TRANS_SUCCESS);
					}
					mListFiles.clear();
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDB, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDB, MsgStrAnalyzer.dph.getCmdId()))) {
				int index = (int) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
				Log.d(TAG, "save .log file is true,fileName==" + fileName + "index==" + pkgIndex + "CURRENT_INDEX==" + index);
				index++;
				if (index < mListFiles.size()) {
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, index);
					String nextfileName = mListFiles.get(index);
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, nextfileName);
					bikewatch_get_bb_offline_log(nextfileName);
				} else {
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
					SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, "");
					Log.i(TAG, "onDataReceived-----,all log file download finished");
					if (index == mListFiles.size()) {
						MsgStrAnalyzer.currentAllFileLength = 0;
						MsgStrAnalyzer.saveCurrentTrkPackageIndex(mContext, 0);
						BBWorkoutsManagerFragment.saveTrkTotalPackageNum(mContext, 0);
						String filename = mListFiles.get(index - 1);
						filename = filename.substring(filename.lastIndexOf(File.separatorChar) + 1);
						String filePathStr = FileUtils.checkExternalDirectoryPathExist(true, device_model, sn, SettingsJsonUtils.DEVICE_LOG, filename);
						callBackSuccessMessage(Constants.DEVICE_GET_LOG_SUCCESS, filePathStr);
					}
					mListFiles.clear();
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDD, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DDD, CmdPackageHeader.getCmdId()))) {
				Log.d(TAG, "save upload_log_file_list.txt file is true,fileName==" + fileName);
				getBBofflineLog();
			}
		} else {
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB2, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DB2, CmdPackageHeader.getCmdId()))) {
				Log.d(TAG, "save .trk&.wk file is false,file transering.....,fileName==" + fileName + " pkgIndex==" + pkgIndex);
				//if (fileName.contains(".trk"))
				{
					callBackSuccessMessage(Constants.UPDATE_TRK_FILE_TRANS_PROGRESS);
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DF0, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DF0, CmdPackageHeader.getCmdId()))) {
				Log.d(TAG, "set log level success");
				callBackSuccessMessage(Constants.DEVICE_LOG_SET_LEVEL_SUCCESS);
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_808E0500, msgContentHeader) || (MsgStrAnalyzer.dph != null && MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_808E0500, CmdPackageHeader.getCmdId()))) {
				Log.d(TAG, "rename success");
				callBackSuccessMessage(Constants.DEVICE_RENAME_SUCCESS);
			}
		}
		// record sending file status
		supportResumeFromBreakpoint((byte[]) deviceMessage.getMsgContent());
	}

	// information
	public void getInfoData() {
		sendData(ProtocolCMD.infomation(INFO_Get_personal_information, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_personal_information, null)));
	}

	public void getDeviceTime() {
		sendData(ProtocolCMD.infomation(INFO_Get_Device_Time, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_Device_Time, null)));
	}

	public void INFO_Get_Battery_level() {
		sendData(ProtocolCMD.infomation(INFO_Get_Battery_level, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_Battery_level, null)));
	}

	public void INFO_Get_device_worn_status() {
		sendData(ProtocolCMD.infomation(INFO_Get_device_worn_status, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_device_worn_status, null)));
	}

	public void INFO_Get_device_charge_status() {
		sendData(ProtocolCMD.infomation(INFO_Get_device_charge_status, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_device_charge_status, null)));
	}

	public void INFO_Get_lift_wrist_to_view_setting_old() {
		sendData(ProtocolCMD.infomation(INFO_Get_lift_wrist_to_view_setting_old, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_lift_wrist_to_view_setting_old, null)));
	}

	public void INFO_Get_lift_wrist_to_view_setting_new() {
		sendData(ProtocolCMD.infomation(INFO_Get_lift_wrist_to_view_setting_new, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_lift_wrist_to_view_setting_new, null)));
	}

	public void INFO_Get_serial_number() {
		sendData(ProtocolCMD.infomation(INFO_Get_serial_number, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_serial_number, null)));
	}

	public void INFO_Get_temp_params() {
		sendData(ProtocolCMD.infomation(INFO_Get_temp_params, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_temp_params, null)));
	}

	public void INFO_Get_distance_unit() {
		sendData(ProtocolCMD.infomation(INFO_Get_distance_unit, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_distance_unit, null)));
	}

	public void INFO_Get_mac_address() {
		sendData(ProtocolCMD.infomation(INFO_Get_mac_address, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_mac_address, null)));
	}

	public void INFO_Get_firmware_version() {
		sendData(ProtocolCMD.infomation(INFO_Get_firmware_version, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_firmware_version, null)));
	}

	public void INFO_Get_the_automatic_heart_rate_interval() {
		sendData(ProtocolCMD.infomation(INFO_Get_the_automatic_heart_rate_interval, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_the_automatic_heart_rate_interval, null)));
	}

	public void INFO_Get_sound_volume() {
		sendData(ProtocolCMD.infomation(INFO_Get_sound_volume, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_sound_volume, null)));
	}

	public void INFO_Get_Phone_book() {
		sendData(ProtocolCMD.infomation(INFO_Get_Phone_book, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_Phone_book, null)));
	}

	public void INFO_Get_watch_size() {
		sendData(ProtocolCMD.infomation(INFO_Get_watch_size, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Get_watch_size, null)));
	}

	public void INFO_get_Amazon_mic_test_volume() {
		sendData(ProtocolCMD.infomation(INFO_get_Amazon_mic_test_volume, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_get_Amazon_mic_test_volume, null)));
	}

	public void INFO_config_weather_control_info() {
		sendData(ProtocolCMD.infomation(INFO_config_weather_control_info, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_config_weather_control_info, null)));
	}

	public void INFO_switch_and_get_broadcast_name_and_mac_address_of_BT() {
		sendData(ProtocolCMD.infomation(INFO_switch_and_get_broadcast_name_and_mac_address_of_BT, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_switch_and_get_broadcast_name_and_mac_address_of_BT, null)));
	}

	public void INFO_Unbind_BT() {
		sendData(ProtocolCMD.infomation(INFO_Unbind_BT, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Unbind_BT, null)));
	}

	public void INFO_Set_personal_information(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_personal_information, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_personal_information, params)));
	}

	public void INFO_Set_Time__Format(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_Time__Format, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Time__Format, params)));
	}

	public void INFO_Set_Device_mode(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_Device_mode, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Device_mode, params)));
	}

	public void INFO_Set_Pairing_phone_type(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_Pairing_phone_type, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Pairing_phone_type, params)));
	}

	public void INFO_Set_Device_Time() {
		sendData(ProtocolCMD.infomation(INFO_Set_Device_Time, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Device_Time, null)));
	}

	public void INFO_Set_Time_Zone_time() {
		sendData(ProtocolCMD.infomation(INFO_Set_Time_Zone_time, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Time_Zone_time, null)));
	}

	public void INFO_Set_band_screens() {
		sendData(ProtocolCMD.infomation(INFO_Set_band_screens, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_band_screens, null)));
	}

	public void INFO_Set_Hand_preference(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_Hand_preference, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Hand_preference, params)));
	}

	public void INFO_Set_lift_wrist_to_view_setting_old(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_lift_wrist_to_view_setting_old, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_lift_wrist_to_view_setting_old, params)));
	}

	public void INFO_Set_lift_wrist_to_view_setting_new(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_lift_wrist_to_view_setting_new, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_lift_wrist_to_view_setting_new, params)));
	}

	public void INFO_Set_serial_number(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_serial_number, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_serial_number, params)));
	}

	public void INFO_Set_connection_key(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_connection_key, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_connection_key, params)));
	}

	public void INFO_Set_the_time_interval_of_the_probe_function(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_the_time_interval_of_the_probe_function, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_the_time_interval_of_the_probe_function, params)));
	}

	public void INFO_Set_temperature_display_type(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_temperature_display_type, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_temperature_display_type, params)));
	}

	public void INFO_Set_Device_auto_monitor_Temp(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_Device_auto_monitor_Temp, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_Device_auto_monitor_Temp, params)));
	}

	public void INFO_Set_distance_display_unit(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_distance_display_unit, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_distance_display_unit, params)));
	}

	public void INFO_set_sound_volume(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_set_sound_volume, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_set_sound_volume, params)));
	}

	public void INFO_set_Phone_book(byte[] params) {
		boolean ret = ProtocolCMD.getPhoneBookDataPacket(params);
		if (ret) {
			sendDataDelay(watchDialMsgHandler, PHONE_BOOK_DATA, 50);
		}
	}

	public void INFO_set_Amazon_Alexa_state(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_set_Amazon_Alexa_state, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_set_Amazon_Alexa_state, params)));
	}

	public void INFO_set_Amazon_Alexa_Status(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_set_Amazon_Alexa_Status, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_set_Amazon_Alexa_Status, params)));
	}

	public void INFO_Set_screen_brightness(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_Set_screen_brightness, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_Set_screen_brightness, params)));
	}

	public void INFO_set_Amazon_mic_test(byte[] params) {
		sendData(ProtocolCMD.infomation(INFO_set_Amazon_mic_test, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.infomation(INFO_set_Amazon_mic_test, params)));
	}

	public void FIT_GET_FITNESS_DAILY_VALUE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_FITNESS_DAILY_VALUE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_FITNESS_DAILY_VALUE, params)));
	}

	public void FIT_GET_ECG_HISTROY_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ECG_HISTROY_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ECG_HISTROY_DATA, params)));
	}

	public void FIT_GET_AUTO_ECG_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_AUTO_ECG_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_AUTO_ECG_DATA, params)));
	}

	public void FIT_GET_HISTROY_TEMP(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_TEMP, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_TEMP, params)));
	}

	public void FIT_GET_5_MINUTES_WALK(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_5_MINUTES_WALK, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_5_MINUTES_WALK, params)));
	}

	public void FIT_GET_HOURLY_WALK_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HOURLY_WALK_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HOURLY_WALK_DATA, params)));
	}

	public void FIT_GET_10_MINUTES_SLEEP(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_10_MINUTES_SLEEP, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_10_MINUTES_SLEEP, params)));
	}

	public void FIT_GET_SPO2_RAW_125hz(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SPO2_RAW_125hz, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SPO2_RAW_125hz, params)));
	}

	public void FIT_GET_LATEST_HEALTH_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_LATEST_HEALTH_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_LATEST_HEALTH_DATA, params)));
	}

	public void FIT_GET_1_MINUTES_SLEEP(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_1_MINUTES_SLEEP, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_1_MINUTES_SLEEP, params)));
	}

	public void FIT_GET_5_MINUTES_RUNNING(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_5_MINUTES_RUNNING, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_5_MINUTES_RUNNING, params)));
	}

	public void FIT_GET_CLIMBING_HISTROY(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_CLIMBING_HISTROY, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_CLIMBING_HISTROY, params)));
	}

	public void FIT_GET_1_MINUTES_CYCLING(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_1_MINUTES_CYCLING, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_1_MINUTES_CYCLING, params)));
	}

	public void FIT_GET_ACTIVITE_HISTROY(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ACTIVITE_HISTROY, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ACTIVITE_HISTROY, params)));
	}

	public void FIT_GET_HISTROY_RR_INTERVAL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_RR_INTERVAL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_RR_INTERVAL, params)));
	}

	public void FIT_GET_GPS_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_GPS_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_GPS_DATA, params)));
	}

	public void FIT_OBTAIN_HR_BP_VALUE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_OBTAIN_HR_BP_VALUE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_OBTAIN_HR_BP_VALUE, params)));
	}

	public void FIT_GET_PROXIMLY_ALART(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_PROXIMLY_ALART, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_PROXIMLY_ALART, params)));
	}

	public void FIT_GET_LIVE_TEMP_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_LIVE_TEMP_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_LIVE_TEMP_DATA, params)));
	}

	public void FIT_GET_CONTACT_TRACING_SUMMARY(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_CONTACT_TRACING_SUMMARY, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_CONTACT_TRACING_SUMMARY, params)));
	}

	public void FIT_GET_CONTACT_TRACING_SPECIFIED(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_CONTACT_TRACING_SPECIFIED, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_CONTACT_TRACING_SPECIFIED, params)));
	}

	public void FIT_GET_HISTROY_PPG_RAW(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_PPG_RAW, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_PPG_RAW, params)));
	}

	public void FIT_GET_HISTROY_ACC_RAW(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_ACC_RAW, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_ACC_RAW, params)));
	}

	public void FIT_GET_SEDENTARY_ALART(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SEDENTARY_ALART, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SEDENTARY_ALART, params)));
	}

	public void FIT_GET_ACTIVITY_CONFIG(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG, params)));
	}

	public void FIT_GET_ACTIVITY_CONFIG_NEW(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG_NEW, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG_NEW, params)));
	}

	public void FIT_GET_ACTIVITY_CONFIG_SUMMARY(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG_SUMMARY, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG_SUMMARY, params)));
	}

	public void FIT_GET_ACTIVITY_CONFIG_DETAIL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG_DETAIL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_CONFIG_DETAIL, params)));
	}

	public void FIT_GET_SP02_PARA() {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SP02_PARA, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SP02_PARA, null)));
	}

	public void FIT_GET_SP02_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SP02_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SP02_DATA, params)));
	}

	public void FIT_GET_SLEEP_TARGET_VALUE() {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SLEEP_TARGET_VALUE, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SLEEP_TARGET_VALUE, null)));
	}

	public void FIT_GET_SLEEP_SUMMARY_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SLEEP_SUMMARY_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SLEEP_SUMMARY_DATA, params)));
	}

	public void FIT_GET_SENSAI_CONFIG(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SENSAI_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SENSAI_CONFIG, params)));
	}

	public void FIT_GET_SENSAI_SUMMARY(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SENSAI_SUMMARY, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SENSAI_SUMMARY, params)));
	}

	public void FIT_GET_SENSAI_DETAIL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_SENSAI_DETAIL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_SENSAI_DETAIL, params)));
	}

	public void FIT_GET_HISTROY_DISTANCE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_DISTANCE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_DISTANCE, params)));
	}

	public void FIT_GET_HISTROY_CALORIE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_CALORIE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_CALORIE, params)));
	}

	public void FIT_GET_TODAY_FITNESS(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_TODAY_FITNESS, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_TODAY_FITNESS, params)));
	}

	public void FIT_GET_HISTROY_STRESS(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HISTROY_STRESS, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HISTROY_STRESS, params)));
	}

	public void FIT_GET_FIRMWARE_CAPABILITY(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_FIRMWARE_CAPABILITY, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_FIRMWARE_CAPABILITY, params)));
	}

	public void FIT_GET_4H_FUNCTION(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_4H_FUNCTION, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_4H_FUNCTION, params)));
	}

	public void FIT_GET_ACTIVITY_GUIDE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_GUIDE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_ACTIVITY_GUIDE, params)));
	}

	public void FIT_SET_DAILY_WALKING(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_DAILY_WALKING, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_DAILY_WALKING, params)));
	}

	public void FIT_SET_AUTO_HR_INTERVAL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_AUTO_HR_INTERVAL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_AUTO_HR_INTERVAL, params)));
	}

	public void FIT_SET_ECG_RAW_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_ECG_RAW_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_ECG_RAW_DATA, params)));
	}

	public void FIT_SET_HR_LIVE_CONTROL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_HR_LIVE_CONTROL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_HR_LIVE_CONTROL, params)));
	}

	public void FIT_SET_SPO2_LIVE_CONTROL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SPO2_LIVE_CONTROL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SPO2_LIVE_CONTROL, params)));
	}

	public void FIT_SET_ERASE_FITNESS_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_ERASE_FITNESS_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_ERASE_FITNESS_DATA, params)));
	}

	public void FIT_SET_BP_LIVE_CONTROL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_BP_LIVE_CONTROL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_BP_LIVE_CONTROL, params)));
	}

	public void FIT_SET_SPORT_MODE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SPORT_MODE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SPORT_MODE, params)));
	}

	public void FIT_SET_UPDATA_HR_ZONE_VALUE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_UPDATA_HR_ZONE_VALUE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_UPDATA_HR_ZONE_VALUE, params)));
	}

	public void FIT_SET_UPDATA_VO2_MAX_VALUE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_UPDATA_VO2_MAX_VALUE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_UPDATA_VO2_MAX_VALUE, params)));
	}

	public void FIT_SET_LIVE_STEPS_CONTROL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_LIVE_STEPS_CONTROL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_LIVE_STEPS_CONTROL, params)));
	}

	public void FIT_SET_GPS_CONTROL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_GPS_CONTROL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_GPS_CONTROL, params)));
	}

	public void FIT_SET_SPORT_MODE_PAUSE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SPORT_MODE_PAUSE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SPORT_MODE_PAUSE, params)));
	}

	public void FIT_SET_SYNC_BP_PARAMS(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SYNC_BP_PARAMS, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SYNC_BP_PARAMS, params)));
	}

	public void FIT_SET_CLEAR_USER_BP_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_CLEAR_USER_BP_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_CLEAR_USER_BP_DATA, params)));
	}

	public void FIT_SET_CLEAR_CONTACT_TRACING_DATA(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_CLEAR_CONTACT_TRACING_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_CLEAR_CONTACT_TRACING_DATA, params)));
	}

	public void FIT_SET_AUTO_PPG_INTERVAL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_AUTO_PPG_INTERVAL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_AUTO_PPG_INTERVAL, params)));
	}

	public void FIT_SET_AUTO_ACC_INTERVAL(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_AUTO_ACC_INTERVAL, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_AUTO_ACC_INTERVAL, params)));
	}

	public void FIT_SET_SPO2_PERIODIC(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SPO2_PERIODIC, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SPO2_PERIODIC, params)));
	}

	public void FIT_SET_SLEEP_TARGET_VALUE(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SLEEP_TARGET_VALUE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SLEEP_TARGET_VALUE, params)));
	}

	public void FIT_SET_STRESS_CONFIG(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_STRESS_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_STRESS_CONFIG, params)));
	}

	public void FIT_SET_HAR_CONFIG(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_HAR_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_HAR_CONFIG, params)));
	}

	public void FIT_GET_HAR_CONFIG() {
		sendData(ProtocolCMD.fitnessData(FIT_GET_HAR_CONFIG, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_GET_HAR_CONFIG, null)));
	}

	public void FIT_SET_SENSAI_CONFIG(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_SENSAI_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_SENSAI_CONFIG, params)));
	}

	public void FIT_SET_START_DESIGNATED_ACT(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_START_DESIGNATED_ACT, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_START_DESIGNATED_ACT, params)));
	}

	public void FIT_SET_4H_BUTTON_FUNCTION(byte[] params) {
		sendData(ProtocolCMD.fitnessData(FIT_SET_4H_BUTTON_FUNCTION, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.fitnessData(FIT_SET_4H_BUTTON_FUNCTION, params)));
	}

	public void ALARM_GET_ALARM_INFO(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_ALARM_INFO, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_ALARM_INFO, params)));
	}

	public void ALARM_GET_DND_setting(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_DND_setting, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_DND_setting, params)));
	}

	public void ALARM_GET_WATCH_FACE_LIST(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_WATCH_FACE_LIST, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_WATCH_FACE_LIST, params)));
	}

	public void ALARM_GET_CUR_WATCH_FACE_ID(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_CUR_WATCH_FACE_ID, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_CUR_WATCH_FACE_ID, params)));
	}

	public void ALARM_GET_SPORTS_NOTIFI_STATUS(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_SPORTS_NOTIFI_STATUS, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_SPORTS_NOTIFI_STATUS, params)));
	}

	public void ALARM_GET_IMAGE_LIST(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_IMAGE_LIST, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_IMAGE_LIST, params)));
	}

	public void ALARM_GET_WATCH_BK_IMGID(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_WATCH_BK_IMGID, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_WATCH_BK_IMGID, params)));
	}

	public void ALARM_GET_QUICK_REPLY_LIST(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_QUICK_REPLY_LIST, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_QUICK_REPLY_LIST, params)));
	}

	public void ALARM_GET_WOMEN_HEALTH_DATA(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_WOMEN_HEALTH_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_WOMEN_HEALTH_DATA, params)));
	}

	public void ALARM_GET_FIND_WATCH(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_FIND_WATCH, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_FIND_WATCH, params)));
	}

	public void ALARM_GET_FIND_WATCH_START(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_GET_FIND_WATCH_START, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_GET_FIND_WATCH_START, params)));
	}

	public void ALARM_SET_DEVICE_EVENT(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_DEVICE_EVENT, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_DEVICE_EVENT, params)));
	}

	public void ALARM_SET_SEDENTARY_ALART(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_SEDENTARY_ALART, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_SEDENTARY_ALART, params)));
	}

	public void ALARM_SET_MUSIC_STATUS(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MUSIC_STATUS, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MUSIC_STATUS, params)));
	}

	public void ALARM_SET_MESSAGE_ALART(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MESSAGE_ALART, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MESSAGE_ALART, params)));
	}

	public void ALARM_SET_MESSAGE_CONTENT(byte[] params) {
		if (params.length <= 178) {
			sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MESSAGE_CONTENT, params));
			callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MESSAGE_CONTENT, params)));
		} else {
			Log.i(TAG, "ALARM_SET_MESSAGE_CONTENT: 7f");
			ProtocolCMD.messageContent(params);
			sendDataDelay(watchDialMsgHandler, MESSAGE_CONTENT_DATA, 0);
		}
	}

	public void ALARM_SET_ALARM_INFO(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_ALARM_INFO, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_ALARM_INFO, params)));
	}

	public void ALARM_SET_MEETING_SYNC(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MEETING_SYNC, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MEETING_SYNC, params)));
	}

	public void ALARM_SET_MEETING_DELETE(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MEETING_DELETE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MEETING_DELETE, params)));
	}

	public void ALARM_SET_DND_MODE(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_DND_MODE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_DND_MODE, params)));
	}

	public void ALARM_SET_MUSIC_ARTIST(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MUSIC_ARTIST, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MUSIC_ARTIST, params)));
	}

	public void ALARM_SET_MUSIC_NAME(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_MUSIC_NAME, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_MUSIC_NAME, params)));
	}

	public void ALARM_SET_STOP_CUR_MESSAGE(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_STOP_CUR_MESSAGE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_STOP_CUR_MESSAGE, params)));
	}

	public void ALARM_SET_CUR_WATCH_FACE_ID(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_CUR_WATCH_FACE_ID, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_CUR_WATCH_FACE_ID, params)));
	}

	public void ALARM_SET_DELETE_WATCH_FACE_ID(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_DELETE_WATCH_FACE_ID, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_DELETE_WATCH_FACE_ID, params)));
	}

	public void ALARM_SET_SPORTS_NOTIFY_SWITCH(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_SPORTS_NOTIFY_SWITCH, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_SPORTS_NOTIFY_SWITCH, params)));
	}

	public void ALARM_SET_DELETE_IMAGE(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_DELETE_IMAGE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_DELETE_IMAGE, params)));
	}

	public void ALARM_SET_WATCH_FACE_BK_IMG(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_WATCH_FACE_BK_IMG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_WATCH_FACE_BK_IMG, params)));
	}

	public void ALARM_SET_UP_QUICK_REPLY_LIST(byte[] params) {
		if (params.length <= 178) {
			sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_UP_QUICK_REPLY_LIST, params));
			callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_UP_QUICK_REPLY_LIST, params)));
		} else {
			ProtocolCMD.quickRPList(params);
			sendDataDelay(watchDialMsgHandler, QUICK_REPLY_LIST, 0);
		}
	}

	public void ALARM_SET_WOMEN_HEALTH_DATA(byte[] params) {
		sendData(ProtocolCMD.AlarmNotifyData(ALARM_SET_WOMEN_HEALTH_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.AlarmNotifyData(ALARM_SET_WOMEN_HEALTH_DATA, params)));
	}

	public void VIBRATOR_GET_CONFIG(byte[] params) {
		sendData(ProtocolCMD.VibratorData(VIBRATOR_GET_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.VibratorData(VIBRATOR_GET_CONFIG, params)));
	}

	public void VIBRATOR_SET_CONFIG(byte[] params) {
		sendData(ProtocolCMD.VibratorData(VIBRATOR_SET_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.VibratorData(VIBRATOR_SET_CONFIG, params)));
	}

	public void SYSTEM_GET_BRIGHT_SCREEN_TIME(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_GET_BRIGHT_SCREEN_TIME, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_GET_BRIGHT_SCREEN_TIME, params)));
	}

	public void SYSTEM_DIAGNOSTICS_MODE(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_DIAGNOSTICS_MODE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_DIAGNOSTICS_MODE, params)));
	}

	public void SYSTEM_DIAGNOSTICS_MODE_CONFIG(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_DIAGNOSTICS_MODE_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_DIAGNOSTICS_MODE_CONFIG, params)));
	}

	public void SYSTEM_RESET_SYSTEM(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_RESET_SYSTEM, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_RESET_SYSTEM, params)));
	}

	public void SYSTEM_POWER_OFF(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_POWER_OFF, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_POWER_OFF, params)));
	}

	public void SYSTEM_POWER_SAVING_CONFIG(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_POWER_SAVING_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_POWER_SAVING_CONFIG, params)));
	}

	public void SYSTEM_GET_POWER_STATUS(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_GET_POWER_STATUS, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_GET_POWER_STATUS, params)));
	}

	public void SYSTEM_GET_SILENCE_MODE(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_GET_SILENCE_MODE, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_GET_SILENCE_MODE, params)));
	}

	public void SYSTEM_GET_SILENCE_MODE_CONFIG(byte[] params) {
		sendData(ProtocolCMD.SystemData(SYSTEM_SET_SILENCE_MODE_CONFIG, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.SystemData(SYSTEM_SET_SILENCE_MODE_CONFIG, params)));
	}

	public void sendNotifyData(int id) {
	}

	public void sendVibratorData(int id) {
	}

	public void sendSystemData(int id) {
	}

	public void TEST_GET_LOG_FILE_NAME() {
		sendData(ProtocolCMD.developTest(TEST_GET_LOG_FILE_NAME, null));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.developTest(TEST_GET_LOG_FILE_NAME, null)));
	}

	public void TEST_REQUEST_LOG_BY_FILE_NAME(byte[] params) {
		sendData(ProtocolCMD.developTest(TEST_REQUEST_LOG_BY_FILE_NAME, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.developTest(TEST_REQUEST_LOG_BY_FILE_NAME, params)));
	}

	public void TEST_START_LOG_OUTPUT(byte[] params) {
		sendData(ProtocolCMD.developTest(TEST_START_LOG_OUTPUT, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.developTest(TEST_START_LOG_OUTPUT, params)));
	}

	public void TEST_WATCH_DIAL_OTA(String path, String id) {
		boolean ret = ProtocolCMD.getDialOTAPacket(path, id);
		if (ret) {
			sendDataDelay(watchDialMsgHandler, WATCH_DIAL_SEND_PACKET_DATA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_get_personal_info(String params) {
		Log.i(TAG, "bikewatch_get_personal_info------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_personal_info, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_personal_info, params)));
	}

	public void bikewatch_set_personal_info(Context context, String id, String jsonFileDir) {
		Log.i(TAG, "bikewatch_set_personal_info------: ");
		boolean ret = ProtocolCMD.convertTransPacket(context, jsonFileDir, id);
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_get_bicycle_info(String params) {
		Log.i(TAG, "bikewatch_get_bicycle_info------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_bicycle_info, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_bicycle_info, params)));
	}

	public void bikewatch_set_bicycle_info(Context context, String id, String jsonFileDir) {
		Log.i(TAG, "bikewatch_set_bicycle_info------: ");
		boolean ret = ProtocolCMD.convertTransPacket(context, jsonFileDir, id);
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_get_settings_info(String params) {
		Log.i(TAG, "bikewatch_get_settings_info------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_settings_info, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_settings_info, params)));
	}

	public void bikewatch_set_settings_info(Context context, String id, String jsonFileDir) {
		Log.i(TAG, "bikewatch_set_settings_info------: ");
		boolean ret = ProtocolCMD.convertTransPacket(context, jsonFileDir, id);
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_reset_settings(String params) {
		Log.i(TAG, "bikewatch_reset_settings------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_Reset_settings, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_Reset_settings, params)));
	}

	public void bikewatch_reset_device(String params) {
		Log.i(TAG, "bikewatch_reset_device------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_Reset_device, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_Reset_device, params)));
	}

	public void bikewatch_get_track_summary(String params) {
		Log.i(TAG, "bikewatch_get_track_summary------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_track_summary, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_track_summary, params)));
	}

	public void bikewatch_send_icoe_public_key() {
		Log.i(TAG, "bikewatch_send_icoe_public_key------: ");
		List<String> tmpList = new ArrayList<String>();
		tmpList.add(bb.lanxing.common.config.Constants.AIROHA_ELPO_PROJECTID_RELEASE);
		boolean ret = ProtocolCMD.bikeWatchDelMultiFiles(BIKEWATCH_ICOE_PUBLIC_KEY, tmpList, "ioce_pglite_key");
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_del_track(List<String> params, int cmdId) {
		Log.i(TAG, "bikewatch_del_track------: ");
		boolean ret = ProtocolCMD.bikeWatchDelMultiFiles(cmdId, params, "delete.json");
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_del_all_track(String id, String jsonFileDir) {
		Log.i(TAG, "bikewatch_del_all_track------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_DEL_ALL_track, ""));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_DEL_ALL_track, "")));
	}

	public void bikewatch_get_track_detail(String params) {
		Log.i(TAG, "bikewatch_get_track_detail------: fileName===" + params);
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_track_detail, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_get_track_detail, params)));
	}

	public void getRouteBooksInfo(String params) {
		Log.i(TAG, "getRouteBooksInfo------: " + params);
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_ROUTE_BOOKS_INFO, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_ROUTE_BOOKS_INFO, params)));
	}

	public void getPanelsInfo(String params) {
		Log.i(TAG, "getPanelsInfo------: " + params);
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_PANELS_INFO, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_PANELS_INFO, params)));
	}

	public void getEmmcInfo() {
		Log.i(TAG, "getEmmcInfo------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_EMMC_INFO, ""));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_EMMC_INFO, "")));
	}

	public void getIcoeDataLeftTime() {
		Log.i(TAG, "getIcoeDataLeftTime------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_ICOE_DATA_LEFT_TIME, ""));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_ICOE_DATA_LEFT_TIME, "")));
	}

	public void bikewatch_get_bb_offline_log(String params) {
		Log.i(TAG, "bikewatch_get_bb_offline_log------: fileName===" + params);
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_BB_OFFLINE_LOG_DATA, params));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_BB_OFFLINE_LOG_DATA, params)));
	}

	public void getBBofflineLog() {
		Log.i(TAG, "getBBofflineLog------: ");
		if (mListFiles != null) {
			SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
			mListFiles.clear();
		}
		String extraPath = FileUtils.checkExternalDirectoryPathExist(true, SettingsJsonUtils.getDeviceModel(mContext), SettingsJsonUtils.getSn(mContext), SettingsJsonUtils.DEVICE_LOG, SettingsJsonUtils.BB_OFFLINE_LOG_JSON);
		Log.i(TAG, "getBBofflineLog PATH: " + extraPath);
		try (BufferedReader br = new BufferedReader(new FileReader(extraPath))) {
			String line;
			int count = 0;
			while ((line = br.readLine()) != null) {
				//System.out.println(line);
				mListFiles.add(line);
				count++;
				if (count >= 30) {
					break;
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (mListFiles == null) {
			return;
		}
		Log.i(TAG, "getBBofflineLog------: params.size()===" + mListFiles.size());
		int index = (int) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
		String fileName = mListFiles.get(index);
		SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, fileName);
		Log.i(TAG, "getBBofflineLog------: index===" + index);
		Log.i(TAG, "getBBofflineLog------: fileName===" + fileName);
		bikewatch_get_bb_offline_log(fileName);
	}

	public void getBBofflineLogLevelInfo() {
		Log.i(TAG, "getBBofflineLogLevelInfo------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_BB_OFFLINE_LOG_LEVEL_INFO, ""));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_BB_OFFLINE_LOG_LEVEL_INFO, "")));
	}

	public void setBBofflineLogLevelInfo(String param) {
		Log.i(TAG, "setBBofflineLogLevelInfo  param = " + param);
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_SET_BB_OFFLINE_LOG_LEVEL_INFO, param));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_SET_BB_OFFLINE_LOG_LEVEL_INFO, param)));
	}

	public void getBBofflineLogConfigList() {
		Log.i(TAG, "getBBofflineLogConfigList------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_BB_OFFLINE_CONFIG_LIST, SettingsJsonUtils.BB_OFFLINE_LOG_JSON));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_GET_BB_OFFLINE_CONFIG_LIST, SettingsJsonUtils.BB_OFFLINE_LOG_JSON)));
	}

	public void setBBPkgMtuMax(String flag) {
		Log.i(TAG, "setBBPkgMtuMax------: ");
		sendData(ProtocolCMD.bikeWatchInfo(BIKEWATCH_SET_BB_PKG_MTU_MAX, flag));
		callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(ProtocolCMD.bikeWatchInfo(BIKEWATCH_SET_BB_PKG_MTU_MAX, "")));
	}

	public void transSystemCommonFile(Context context, String path, String fileName) {
		Log.i(TAG, "transSystemCommonFile -----" + getDeviceConnectState() + " fileName: " + fileName);
		boolean ret = ProtocolCMD.convertTransPacket(context, path, fileName);
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void bikewatch_send_routebooks_file(Context context, String params) {
		Log.i(TAG, "bikewatch_send_routebooks_file------: name===" + params);
		Log.i(TAG, "bikewatch_send_routebooks_file -----" + getDeviceConnectState());
		CommonUtil.saveCurrentPackageCMD(context, "00");
		CommonUtil.saveCurrentPackageIndex(context, 0);
		boolean ret = false;
		//if (params.contains("ELPO_GR3_1.DAT") || params.contains("ELPO_GAL_3.DAT") || params.contains("ELPO_BDS_3.DAT")) {
		if (params.contains("f1e1G3.pgl") || params.contains("f1e1E3.pgl") || params.contains("f1e1C3.pgl")) {
			ret = ProtocolCMD.sendRouteBooksFiles(context, SYSTEM_TRANS_ELPO_DATA_FILE, params);
		} else {
			ret = ProtocolCMD.sendRouteBooksFiles(context, BIKEWATCH_SEND_ROUTEBOOKS_FILES, params);
		}
		if (ret) {
			sendDataDelay(watchDialMsgHandler, QUICK_OTA, mWatchDialSendPacket);
		}
	}

	public void saveFilesList(List<String> params) {
		if (mListRouteBooksFiles != null) {
			SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, 0);
			SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, "");
			mListRouteBooksFiles.clear();
		}
		for (int i = 0; i < params.size(); i++) {
			Log.i(TAG, "saveFilesList------: name===" + params.get(i));
			String fileName = params.get(i);
			mListRouteBooksFiles.add(fileName);
		}
	}

	public void transRouteBooksFiles(List<String> params) {
		if (mListRouteBooksFiles != null) {
			SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, 0);
			SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, "");
			mListRouteBooksFiles.clear();
		}

		for (int i = 0; i < params.size(); i++) {
			Log.i(TAG, "transRouteBooksFiles------: name===" + params.get(i));
			String fileName = params.get(i);
			mListRouteBooksFiles.add(fileName);
		}
		int index = (int) SPHelper.getPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, 0);
		String fileName = mListRouteBooksFiles.get(index);
		SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, fileName);
		index++;
		SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, index);
		Log.i(TAG, "transRouteBooksFiles------: index===" + index);
		Log.i(TAG, "transRouteBooksFiles------: fileName===" + fileName);
		bikewatch_send_routebooks_file(mContext, fileName);
	}

	public void getTracksFiles(List<String> params) {
		if (mListFiles != null) {
			SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
			mListFiles.clear();
		}
		if (params == null) {
			return;
		}
		Log.i(TAG, "getTracksFiles------: params.size()===" + params.size());
		for (int i = 0; i < params.size(); i++) {
			String fileName = params.get(i) + ".trk";
			String fileNameWK = params.get(i) + ".wk";
			//String fileNameGPX = params.get(i) + ".gpxb";
			mListFiles.add(fileName);
			mListFiles.add(fileNameWK);
			//mListFiles.add(fileNameGPX);
		}
		bikewatch_send_trans_file();
	}

	public void bikewatch_send_trans_file() {
		Log.i(TAG, "bikewatch_send_trans_file------: ");
		int index = (int) SPHelper.getPreference(mContext, KEY_SEND_FILE_CURRENT_INDEX, 0);
		String fileName = mListFiles.get(index);
		SPHelper.putPreference(mContext, KEY_SEND_FILE_CURRENT_FILENAME, fileName);
		Log.i(TAG, "getTracksFiles------: index===" + index);
		Log.i(TAG, "getTracksFiles------: fileName===" + fileName);
		bikewatch_get_track_detail(fileName);
	}

	public void bikewatch_send_giveup_trans_file(Context context) {
		Log.i(TAG, "bikewatch_send_giveup_trans_file------: ");
		Log.i(TAG, "bikewatch_send_giveup_trans_file -----" + getDeviceConnectState());
		MsgStrAnalyzer.currentAllFileLength = 0;
		MsgStrAnalyzer.saveCurrentTrkPackageIndex(mContext, 0);
		BesSdkConstants.BES_BLE_GIVEUP_TRANS_VALUE = true;
		pauseTransFilesHandler(context);
		sendData(ProtocolCMD.sendGiveUpTransFiles(context));
	}

	public void supportResumeFromBreakpoint(byte[] msgContByte) {
		Log.i(TAG, "supportResumeFromBreakpoint------: ");
		byte[] msgContentHeader = new byte[Constants.CMD_HEADER_LEN];
		System.arraycopy((byte[]) msgContByte, 0, msgContentHeader, 0, Constants.CMD_HEADER_LEN);
		if (msgContByte.length == 7) {
			int pkgIndex = MsgStrAnalyzer.byteToBigInteger((byte[]) msgContByte, Constants.MULTI_PACKAGE_INDEX_START + 2, Constants.MULTI_PACKAGE_PACK_NUM_START + 2);
			int totalPkgNum = CommonUtil.getCurrentPackageTotalNum(mContext);
			int index = (int) SPHelper.getPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, 0);
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DC5, msgContentHeader) && pkgIndex == totalPkgNum - 1) {
				Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DC5---: index===" + index + "currentPkg===" + pkgIndex + "totalPkgNum===" + totalPkgNum);
				SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, index);
				String nextfileName = mListRouteBooksFiles.get(index);
				SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, nextfileName);
				Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DC5---: fileName===" + nextfileName);
				bikewatch_send_routebooks_file(mContext, nextfileName);
				index++;
				SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, index);
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DD2, msgContentHeader) && pkgIndex == totalPkgNum - 1) {
				if (index < mListRouteBooksFiles.size()) {
					Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DD2---: index===" + index + "currentPkg===" + pkgIndex + "totalPkgNum===" + totalPkgNum);
					String nextfileName = mListRouteBooksFiles.get(index);
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, nextfileName);
					Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DD2---: fileName===" + nextfileName);
					bikewatch_send_routebooks_file(mContext, nextfileName);
					index++;
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, index);
				} else {
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, 0);
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, "");
					if (index == mListRouteBooksFiles.size() && pkgIndex == totalPkgNum - 1) {
						Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DD2--,send all routebooks file finished======");
						callBackSuccessMessage(Constants.TOTAL_ROUTE_FILES_ALL_TRANS_SUCCESS);
					}
					mListRouteBooksFiles.clear();
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DC6, msgContentHeader) && pkgIndex == totalPkgNum - 1) {
				if (index < mListRouteBooksFiles.size()) {
					Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DC6---: index===" + index + "currentPkg===" + pkgIndex + "totalPkgNum===" + totalPkgNum);
					String nextfileName = mListRouteBooksFiles.get(index);
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, nextfileName);
					Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DC6---: fileName===" + nextfileName);
					bikewatch_send_routebooks_file(mContext, nextfileName);
					index++;
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, index);
				} else {
					SPHelper.putPreference(mContext, BesSdkConstants.BES_BLE_KEY_ELPO_RUNNING_FLAG, 0);
					SPHelper.putPreference(mContext, BesSdkConstants.BES_BLE_KEY_ELPO_CMD_ID, 0);
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_INDEX, 0);
					SPHelper.putPreference(mContext, KEY_SEND_ROUTEBOOKS_CURRENT_FILENAME, "");
					Log.i(TAG, "supportResumeFromBreakpoint---CMD_AW_8DC6--,all file send elpo finished======");
					mContext.sendBroadcast(new Intent(com.besall.allbase.common.Constants.ACTION_DISMISS_LOADING));
					callBackStateChangedMessage(ProtocolConstants.SYSTEM_TRANS_ELPO_DATA_FILE, mContext.getString(R.string.str_sync_notification_ticker));
					mListRouteBooksFiles.clear();
				}
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DCD, msgContentHeader)) {
				bikewatch_send_icoe_public_key();
			}
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_8DE6, msgContentHeader)) {
				int elpoRunFlag = (int) SPHelper.getPreference(mContext, BesSdkConstants.BES_BLE_KEY_ELPO_RUNNING_FLAG, 0);
				CommonUtil.downloadELPOData(mContext, ProtocolService.this);
			}
		} else {
			if (MsgStrAnalyzer.isSameCmd(Constants.CMD_AW_0682, msgContentHeader) && msgContByte.length == 5) {
				SPHelper.putPreference(mContext, BesSdkConstants.BES_BLE_KEY_ELPO_RUNNING_FLAG, 0);
				SPHelper.putPreference(mContext, BesSdkConstants.BES_BLE_KEY_ELPO_CMD_ID, 0);
				// wangsm add ui logic
				callBackSuccessMessage(Constants.SYSTEM_DOWN_LOW_VOLT);
			}
		}
	}

	public void pauseTransFilesHandler(Context context) {
		watchDialMsgHandler.removeCallbacksAndMessages(null);
		CommonUtil.saveCurrentPackageIndex(context, 0);
		SPHelper.putPreference(mContext, "pauseTransFilesHandler", true);
	}

	public void resumeTransFilesHandler() {
		SPHelper.putPreference(mContext, "pauseTransFilesHandler", false);
	}

	public void sendPacketsWithDelay(List<byte[]> packets, long millis) {
		packet = packets;
		CommonUtil.saveCurrentPackageTotalNum(mContext, packet.size());
		milliS = millis;
		sendDataDelay(watchDialMsgHandler, QUICK_OTA, millis);
	}

	private final Handler watchDialMsgHandler = new Handler(mHandlerThread.getLooper()) {
		@Override public void handleMessage(@NonNull Message msg) {
			super.handleMessage(msg);
			switch (msg.what) {
				case WATCH_DIAL_SEND_PACKET_DATA:
					byte[] data = ProtocolCMD.sendWatchDialPacket();
					addTimeOut(1000);
					if (data[0] == 0x00) {
						ProtocolCMD.otaSuccess();
						return;
					}
					boolean ret = sendData(data, mWatchDialSendPacket);
					if (ret) {
						ProtocolCMD.successSend();
						sendDataDelay(watchDialMsgHandler, WATCH_DIAL_SEND_PACKET_DATA, mWatchDialSendPacket);
					}
					break;
				case PHONE_BOOK_DATA:
					byte[] phoneBookData = ProtocolCMD.sendWatchDialPacket();
					if (phoneBookData[0] == 0x00) {
						ProtocolCMD.otaSuccess();
						return;
					}
					boolean BookRet = sendData(phoneBookData, mWatchDialSendPacket);
					if (BookRet) {
						ProtocolCMD.successSend();
					}
					sendDataDelay(watchDialMsgHandler, PHONE_BOOK_DATA, mWatchDialSendPacket);
					break;
				case MESSAGE_CONTENT_DATA:
					Log.i(TAG, "handleMessage: MESSAGE_CONTENT_DATA");
					byte[] messageContentDataPackage = ProtocolCMD.sendWatchDialPacket();
					sendData(messageContentDataPackage, mWatchDialSendPacket);
					if (ProtocolCMD.PKGS < 2) {
						sendDataDelay(watchDialMsgHandler, MESSAGE_CONTENT_DATA, mWatchDialSendPacket);
						ProtocolCMD.successSend();
					} else {
						ProtocolCMD.otaSuccess();
						return;
					}
					callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(messageContentDataPackage));
					break;
				case QUICK_REPLY_LIST:
					byte[] quickReplyPacket = ProtocolCMD.sendWatchDialPacket();
					if (quickReplyPacket[0] == 0x00) {
						ProtocolCMD.otaSuccess();
						return;
					}
					boolean reply = sendData(quickReplyPacket, mWatchDialSendPacket);
					if (reply) {
						ProtocolCMD.successSend();
					}
					sendDataDelay(watchDialMsgHandler, QUICK_REPLY_LIST, mWatchDialSendPacket);
					callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(quickReplyPacket));
					break;
				case QUICK_OTA:
					if (p == 0) {
						packet = ProtocolCMD.getAllCmdPacket();
					}
					Log.i(TAG, "QUICK_OTA: current_index===" + p);
					Log.i(TAG, "QUICK_OTA packet.size: " + packet.size());
					if (packet.isEmpty()) {
						Log.i(TAG, "QUICK_OTA packet.size: empty!!!");
						return;
					}
					if (p == packet.size() || (packet.size() == 1 && packet.get(0)[0] == 0x00)) {
						Log.i(TAG, "QUICK_OTA: send finished");
						packet.clear();
						ProtocolCMD.otaSuccess();
						p = 0;
						CommonUtil.saveCurrentPackageIndex(mContext, p);
						return;
					}
					boolean result = sendData(packet.get(p), milliS);
					if (result) {
						p++;
					}
					sendDataDelay(watchDialMsgHandler, QUICK_OTA, milliS);
					break;
				default:
					break;
			}
		}
	};
	/**
	 private final Handler watchDialMsgHandler = new Handler(mHandlerThread.getLooper()) {
	@Override public void handleMessage(@NonNull Message msg) {
	super.handleMessage(msg);
	switch (msg.what) {
	case WATCH_DIAL_SEND_PACKET_DATA:
	new Thread(() -> {
	try {
	int pkg_index = CommonUtil.getCurrentPackageIndex(mContext);
	byte[] data = ProtocolCMD.sendWatchDialPacket(mContext, pkg_index);
	if (data[0] == 0x00) {
	CommonUtil.saveCurrentPackageIndex(mContext, 0);
	SPHelper.putPreference(mContext, BesSdkConstants.BES_BLE_RETRY_TRANS_KEY, BesSdkConstants.BES_BLE_RETRY_TRANS_VALUE);
	return;
	}
	boolean ret = sendData(data);
	boolean retryTransFlag = (boolean) SPHelper.getPreference(mContext, BesSdkConstants.BES_BLE_RETRY_TRANS_KEY, BesSdkConstants.BES_BLE_RETRY_TRANS_VALUE);
	if (retryTransFlag) {
	Log.i(TAG, "WATCH_DIAL_SEND_PACKET_DATA: retryTransFlag====" + retryTransFlag);
	SPHelper.putPreference(mContext, BesSdkConstants.BES_BLE_RETRY_TRANS_KEY, BesSdkConstants.BES_BLE_RETRY_TRANS_VALUE);
	Thread.sleep(mWatchDialSendPacket);
	boolean retRetry = sendData(data);
	if (retRetry && !BesSdkConstants.BES_BLE_GIVEUP_TRANS_VALUE) {
	sendDataDelay(watchDialMsgHandler, WATCH_DIAL_SEND_PACKET_DATA, mWatchDialSendPacket);
	}
	} else {
	if (ret && !BesSdkConstants.BES_BLE_GIVEUP_TRANS_VALUE) {
	sendDataDelay(watchDialMsgHandler, WATCH_DIAL_SEND_PACKET_DATA, mWatchDialSendPacket);
	}
	}
	pkg_index++;
	CommonUtil.saveCurrentPackageIndex(mContext, pkg_index);
	} catch (Exception e) {
	e.printStackTrace();
	}
	}).start();
	break;
	case PHONE_BOOK_DATA:
	int pkg_phonebook_index = CommonUtil.getCurrentPackageIndex(mContext);
	byte[] phoneBookData = ProtocolCMD.sendWatchDialPacket(mContext, pkg_phonebook_index);
	pkg_phonebook_index++;
	CommonUtil.saveCurrentPackageIndex(mContext, pkg_phonebook_index);
	if (phoneBookData[0] == 0x00) {
	CommonUtil.saveCurrentPackageIndex(mContext, 0);
	return;
	}
	boolean BookRet = sendData(phoneBookData, 50);
	if (BookRet) {
	sendDataDelay(watchDialMsgHandler, PHONE_BOOK_DATA, 50);
	}
	callBackStateChangedMessage(ProtocolConstants.RETURN_SEND_LOG, ArrayUtil.toHex(phoneBookData));
	break;
	default:
	break;
	}
	}
	};**/
}
